package oop.core.view;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;

import oop.core.view.listeners.ToMainMenuListener;


/**
 * This menu holds all the information that allows a person
 * to pick the occupation they are going to have for their
 * avatar.
 * 
 *
 */
public class CharacterCreationMenu extends SizeablePanel
{
	public static final String ID = "CHARACTER_CREATION_MENU";
	public static final String NEW_SMASHER = "Smasher";
	public static final String NEW_SUMMONER = "Summoner";
	public static final String NEW_SNEAK = "Sneak";
	
	private static final Dimension SIZE = new Dimension(1000, 800);
	private static final Point LOCATION = new Point(0, 0);
	
	private JButton smasherButton;
	private JButton summonerButton;
	private JButton sneakButton;
	private JButton backButton;
	
	/**
	 * Constructor. Sets the layout and buttons.
	 */
	public CharacterCreationMenu()
	{
		super(LOCATION, SIZE);
		
		smasherButton = new JButton(NEW_SMASHER);
		smasherButton.setLocation(300, 100);
		smasherButton.setSize(150, 30);
		smasherButton.setVisible(true);
		this.add(smasherButton);
		
		summonerButton = new JButton(NEW_SUMMONER);
		summonerButton.setLocation(300, 200);
		summonerButton.setSize(150, 30);
		summonerButton.setVisible(true);
		this.add(summonerButton);
		
		sneakButton = new JButton(NEW_SNEAK);
		sneakButton.setLocation(300, 300);
		sneakButton.setSize(150, 30);
		sneakButton.setVisible(true);
		this.add(sneakButton);
		
		backButton = new JButton("Back");
		backButton.setLocation(300, 400);
		backButton.setSize(150, 30);
		backButton.setVisible(true);
		this.add(backButton);
	}
	
	/**
	 * Adds listeners to the buttons
	 * @param listener
	 */
	public void addButtonListeners(ActionListener listener)
	{
		smasherButton.addActionListener(listener);
		summonerButton.addActionListener(listener);
		sneakButton.addActionListener(listener);
	}
	
	/**
	 * Back button listeners
	 * @param listener
	 */
	public void addBackButtonListener(ActionListener listener)
	{
		backButton.addActionListener(listener);
	}
	
	/**
	 * Render the menu
	 */
	protected void paintComponent(Graphics g)
	{
		System.out.println("Painting CharacterCreationMenu");
		g.setColor(Color.BLUE);
		g.fillRect(LOCATION.x, LOCATION.y, SIZE.width, SIZE.height);
	}
}
